package com.base.study.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.base.commonlib.recy.BasicRecyViewHolder;
import com.base.study.R;
import com.base.study.bean.EsDetailBean;

public class EsDetailAdapter extends RecyclerView.Adapter<EsDetailAdapter.RecyViewHolder> {

    private EsDetailBean esDetailBean;
    private Context context;

    public EsDetailAdapter(Context context,EsDetailBean esDetailBean) {
        this.esDetailBean = esDetailBean;
        this.context=context;
    }


    @Override
    public RecyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_search_detail, parent, false);
        return new RecyViewHolder(view);
    }

    @Override
    public void onBindViewHolder(RecyViewHolder holder, int position) {
        holder.text.setText(esDetailBean.getData().get(position));
    }

    @Override
    public int getItemCount() {
        return esDetailBean.getData().size();
    }

    public static class RecyViewHolder extends BasicRecyViewHolder {
        TextView text;
        public RecyViewHolder(View itemView) {
            super(itemView);
            text =  itemView.findViewById(R.id.text);
        }
    }
}
